home *** CD-ROM | disk | FTP | other *** search
/ Internet News 2002 June / Internet News 2002-06 - CD-ROM.rar / INCD200206.ISO / Promo / Shopla / codicecrome.js next >
Text File  |  2002-05-19  |  37KB  |  276 lines

  1. <!-- // chromeless windows v2.1
  2. // www.microbians.com / Gabriel Suchowolski power[z]one - powerz@microbians.com
  3. function openchromeless(theURL, wname, W, H, windowCERRARa, windowCERRARd, windowCERRARo, windowNONEgrf, windowCLOCK, windowTIT, windowREALtit , windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel) {
  4. var windowW = W;
  5.     var windowH = H;
  6.     var windowX = Math.ceil( (window.screen.width  - windowW) / 2 );
  7.     var windowY = Math.ceil( (window.screen.height - windowH) / 2 );
  8. if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4) isie=true
  9.     else                                                 isie=false
  10. if (isie) { H=H+20+2; W=W+2; }
  11. s = ",width="+W+",height="+H;
  12. if (isie && (navigator.userAgent.toLowerCase().indexOf("win")!=-1) ) {
  13. var dowin = theURL != "" ? true : false;
  14. var chromeTIThtml = '\n' +
  15. '<html>                                                                                            '+ '\n'+
  16. '<head>                                                                                                                                                                             '+ '\n'+
  17. '<title> CHROMELESS WINDOWS / TITLEBAR</title>                                                                                                                              '+ '\n'+
  18. '<style type="text/css">                                                                                                                                                            '+ '\n'+
  19. '#mywindowTITLE     { position: absolute; left:   0px; top:   0px; width: 100%; height: 22px; z-index: 1; background-color: '+windowTITBGCOLOR+'; clip:rect(0,100%,22,0); }         '+ '\n'+
  20. '#mywindow         { position: absolute; left:   0px; top:   0px; width: 100%; height: 22px; z-index: 2;                                      clip:rect(0,100%;22,0); }         '+ '\n'+
  21. '#mywindowCLOSE     { position: absolute; left: -22px; top: -22px; width: 11px; height: 11px; z-index: 3;                                      clip:rect(0,11,11,0);   }         '+ '\n'+
  22. '#mywindowCLOCK     { position: absolute; left: -22px; top: -22px; width: 11px; height: 11px; z-index: 3;                                      clip:rect(0,11,11,0);   }         '+ '\n'+
  23. '</style>                                                                                                                                                                           '+ '\n'+
  24. '<script language="javascript">                                                                                '+ '\n'
  25. if ( theURL != "" ) {
  26. chromeTIThtml = chromeTIThtml + 
  27. '    theURL                 = "'+theURL            +'"                                                                                                                             '+ '\n'+
  28. '    windowCERRARa         = "'+windowCERRARa        +'"                                                                                                                             '+ '\n'+
  29. '    windowCERRARd         = "'+windowCERRARd        +'"                                                                                                                             '+ '\n'+
  30. '    windowCERRARo         = "'+windowCERRARo        +'"                                                                                                                             '+ '\n'+
  31. '    windowCLOCK         = "'+windowCLOCK            +'"                                                                                                                             '+ '\n'+
  32. '    windowBORDERCOLOR   = "'+windowBORDERCOLOR    +'"                                                                                                                             '+ '\n'+
  33. '    windowBORDERCOLORsel= "'+windowBORDERCOLORsel    +'"                                                                                                                             '+ '\n'+
  34. '    windowTITBGCOLOR    = "'+windowTITBGCOLOR    +'"                                                                                                                             '+ '\n'+
  35. '    windowTITBGCOLORsel = "'+windowTITBGCOLORsel    +'"                                                                                                                             '+ '\n'
  36. } else {
  37. chromeTIThtml = chromeTIThtml + 
  38. '    theURL="about:blank"                                                                                                                                                            '+ '\n'+
  39. '    windowCERRARa         = "img/close_a.gif"                                                                                                                                     '+ '\n'+
  40. '    windowCERRARd         = "img/close_d.gif"                                                                                                                                     '+ '\n'+
  41. '    windowCERRARo         = "img/close_o.gif"                                                                                                                                     '+ '\n'+
  42. '    windowCLOCK             = "img/clock.gif"                                                                                                                                     '+ '\n'+
  43. '    windowTIT             = "<font face=verdana size=1> ¥ window title</font>"                                                                                               '+ '\n'+
  44. '    windowBORDERCOLOR       = "#000000"                                                                                                                                             '+ '\n'+
  45. '    windowBORDERCOLORsel    = "#FF8A00"                                                                                                                                             '+ '\n'+
  46. '    windowTITBGCOLOR        = "#d7dcd9"                                                                                                                                             '+ '\n'+
  47. '    windowTITBGCOLORsel     = "#ffffff"                                                                                                                                             '+ '\n'
  48. }
  49. chromeTIThtml = chromeTIThtml + 
  50. 'var windowCERRARImg_a = new Image(); windowCERRARImg_a.src = windowCERRARa;                                                                                                            '+ '\n'+
  51. 'var windowCERRARImg_d = new Image(); windowCERRARImg_d.src = windowCERRARd;                                                                                                            '+ '\n'+
  52. 'var windowCERRARImg_o = new Image(); windowCERRARImg_o.src = windowCERRARo;                                                                                                            '+ '\n'+
  53. 'var windowCLOCKImg    = new Image();    windowCLOCKImg.src = windowCLOCK;                                                                                                              '+ '\n'+
  54. '                                                                                                                                                                                       '+ '\n'+
  55. 'function mouseSTATUS() {                                                                                                                                                               '+ '\n'+
  56. '    this.x       = null;                                                                                                                                                            '+ '\n'+
  57. '    this.y       = null;                                                                                                                                                            '+ '\n'+
  58. '    this.bt      = "up";                                                                                                                                                            '+ '\n'+
  59. '    this.oldx    = null;                                                                                                                                                            '+ '\n'+
  60. '    this.oldy    = null;                                                                                                                                                            '+ '\n'+
  61. '    this.dx      = null;                                                                                                                                                            '+ '\n'+
  62. '    this.dy      = null;                                                                                                                                                            '+ '\n'+
  63. '    this.screeny = null;                                                                                                                                                            '+ '\n'+
  64. '    this.screenx = null;                                                                                                                                                            '+ '\n'+
  65. '                                                                                                                                                                                       '+ '\n'+
  66. '    this.element = null;                                                                                                                                                            '+ '\n'+
  67. '    this.event   = null;                                                                                                                                                            '+ '\n'+
  68. '}                                                                                                                                                                                      '+ '\n'+
  69. '                                                                                                                                                                                       '+ '\n'+
  70. 'var mouse = new mouseSTATUS();                                                                                                                                                         '+ '\n'+
  71. '                                                                                                                                                                                       '+ '\n'+
  72. 'function actualizateMouseSTATUS(e) {                                                                                                                                                   '+ '\n'+
  73. '    if (!e) var e = event                                                                                                                                                           '+ '\n'+
  74. '    if ( (e.type=="mousedown" || e.type=="mouseup") && e.button!=1) return true                                                                                                     '+ '\n'+
  75. '                                                                                                                                                                                       '+ '\n'+
  76. '    var x=e.x+document.body.scrollLeft                                                                                                                                              '+ '\n'+
  77. '    var y=e.y+document.body.scrollTop                                                                                                                                               '+ '\n'+
  78. '                                                                                                                                                                                       '+ '\n'+
  79. '    mouse.x   = x;                                                                                                                                                                  '+ '\n'+
  80. '    mouse.y   = y;                                                                                                                                                                  '+ '\n'+
  81. '                                                                                                                                                                                       '+ '\n'+
  82. '         if ( e.type == "mousedown" ) mouse.bt = "down";                                                                                                                            '+ '\n'+
  83. '    else if ( e.type == "mouseup" )   mouse.bt = "up";                                                                                                                              '+ '\n'+
  84. '                                                                                                                                                                                       '+ '\n'+
  85. '    if (window.event) {                                                                                                                                                             '+ '\n'+
  86. '        mouse.screenx=window.event.screenX;                                                                                                                                     '+ '\n'+
  87. '        mouse.screeny=window.event.screenY;                                                                                                                                     '+ '\n'+
  88. '    } else {                                                                                                                                                                        '+ '\n'+
  89. '        mouse.screenx=-1;                                                                                                                                                       '+ '\n'+
  90. '        mouse.screeny=-1;                                                                                                                                                       '+ '\n'+
  91. '    }                                                                                                                                                                               '+ '\n'+
  92. '                                                                                                                                                                                       '+ '\n'+
  93. '}                                                                                                                                                                                      '+ '\n'+
  94. '                                                                                                                                                                                       '+ '\n'+
  95. '                                                                                                                                                                                       '+ '\n'+
  96. 'function initMouseEvents() {                                                                                                                                                           '+ '\n'+
  97. '    document.onmousedown = actualizateMouseSTATUS                                                                                                                                   '+ '\n'+
  98. '    document.onmousemove = actualizateMouseSTATUS                                                                                                                                   '+ '\n'+
  99. '    document.onmouseup   = actualizateMouseSTATUS                                                                                                                                   '+ '\n'+
  100. '    document.onselectstart = selectstart                                                                                                                                            '+ '\n'+
  101. '    document.ondragstart   = new Function("actualizateMouseSTATUS(event); return false;")                                                                                           '+ '\n'+
  102. '}                                                                                                                                                                                      '+ '\n'+
  103. '                                                                                                                                                                                       '+ '\n'+
  104. 'function selectstart(){                                                                                                                                                                '+ '\n'+
  105. '    if ( event.srcElement.tagName != "INPUT" && event.srcElement.tagName != "TEXTAREA") { return false; }                                                                           '+ '\n'+
  106. '    else { mouse.bt="up"; return true; }                                                                                                                                            '+ '\n'+
  107. '}                                                                                                                                                                                      '+ '\n'+
  108. '                                                                                            '+ '\n'+
  109. 'initMouseEvents()                                                                                                                                                                      '+ '\n'+
  110. '                                                                                            '+ '\n'+
  111. 'var mywindowbt    ="up";                                                                                                                                                               '+ '\n'+
  112. 'var wincloseSTATUS="up";                                                                                                                                                               '+ '\n'+
  113. '                                                                                            '+ '\n'+
  114. 'var ofx=0;                                                                                                                                                                             '+ '\n'+
  115. 'var ofy=0;                                                                                                                                                                             '+ '\n'+
  116. 'var opx=0;                                                                                                                                                                             '+ '\n'+
  117. 'var opy=0;                                                                                                                                                                             '+ '\n'+
  118. 'var px=0;                                                                                                                                                                              '+ '\n'+
  119. 'var py=0;                                                                                                                                                                              '+ '\n'+
  120. '                                                                                            '+ '\n'+
  121. 'var wcpx1=-1, wcpy1=-1;                                                                                                                                                                '+ '\n'+
  122. 'var wcpx2=-1, wcpy2=-1;                                                                                                                                                                '+ '\n'+
  123. '                                                                                            '+ '\n'+
  124. 'var wclosechanged = false;                                                                                                                                                             '+ '\n'+
  125. '                                                                                            '+ '\n'+
  126. 'function initToMoveWin() {                                                                                                                                                             '+ '\n'+
  127. '        if (wincloseSTATUS=="up" && ( mywindowbt=="up" || mywindowbt=="over") ) {                                                                                               '+ '\n'+
  128. '                                                                                                                     '+ '\n'+
  129. '                if ( parent.mainloaded ) document.all["mywindowCLOCK"].style.visibility = "hidden";                                                             '+ '\n'+
  130. '                                                                                                                     '+ '\n'+
  131. '                document.all["mywindowCLOCK"].style.pixelLeft=document.body.clientWidth-36                                         '+ '\n'+
  132. '                document.all["mywindowCLOCK"].style.pixelTop =4                                                                                         '+ '\n'+
  133. '                                                                                                                     '+ '\n'+
  134. '                wcpx1 = document.all["mywindowCLOSE"].style.pixelLeft=document.body.clientWidth-18                                                                      '+ '\n'+
  135. '                wcpy1 = document.all["mywindowCLOSE"].style.pixelTop =4                                                                                                 '+ '\n'+
  136. '                wcpx2 = wcpx1 + 11 - 1                                                                                                                                  '+ '\n'+
  137. '                wcpy2 = wcpy1 + 11 - 1                                                                                                                                  '+ '\n'+
  138. '                if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2) {                                                                    '+ '\n'+
  139. '                    if (wclosechanged == false) {                                                                                                                   '+ '\n'+
  140. '                        document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_o.src                                                     '+ '\n'+
  141. '                        wclosechanged = true                                                                                                                    '+ '\n'+
  142. '                    }                                                                                                                                               '+ '\n'+
  143. '                                                                                                                                                                '+ '\n'+
  144. '                } else if (wclosechanged == true) {                                                                                                                     '+ '\n'+
  145. '                    document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_d.src                                                             '+ '\n'+
  146. '                    wclosechanged = false                                                                                                                           '+ '\n'+
  147. '                }                                                                                                                                                       '+ '\n'+
  148. '        }                                                                                                                                                                       '+ '\n'+
  149. '                                                                                            '+ '\n'+
  150. '             if (   mouse.y <= 22 && mouse.y >= 1   && mywindowbt == "up"   && mouse.bt =="up"    ) { mywindowbt = "over" }                                                     '+ '\n'+
  151. '        else if ( ( mouse.y  > 22 || mouse.y <  1 ) && mywindowbt == "over" && mouse.bt =="up"    ) { mywindowbt = "up"   }                                                     '+ '\n'+
  152. '        else if (   mouse.y <= 22 && mouse.y >= 1   && mywindowbt == "over" && mouse.bt == "down" ) {                                                                           '+ '\n'+
  153. '            self.window.focus();                                                                                                                                            '+ '\n'+
  154. '                                                                                                                                                                                    '+ '\n'+
  155. '            if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2 ) {                                                                           '+ '\n'+
  156. '                wincloseSTATUS="down"                                                                                                                                   '+ '\n'+
  157. '                document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_a.src                                                                     '+ '\n'+
  158. '            } else {                                                                                                                                                        '+ '\n'+
  159. '                document.all["mywindowTITLE"].style.backgroundColor = windowTITBGCOLORsel                                                                               '+ '\n'+
  160. '                document.body.style.borderColor    = windowBORDERCOLORsel                                                                                               '+ '\n'+
  161. '                parent.chromewinb.document.bgColor = windowBORDERCOLORsel                                                                                               '+ '\n'+
  162. '                parent.chromewinl.document.bgColor = windowBORDERCOLORsel                                                                                               '+ '\n'+
  163. '                parent.chromewinr.document.bgColor = windowBORDERCOLORsel                                                                                               '+ '\n'+
  164. '                ofx =  mouse.x;                                                                                                                                         '+ '\n'+
  165. '                ofy =  mouse.y;                                                                                                                                         '+ '\n'+
  166. '                opx =  mouse.x;                                                                                                                                         '+ '\n'+
  167. '                opy =  mouse.y;                                                                                                                                         '+ '\n'+
  168. '            }                                                                                                                                                            '+ '\n'+
  169. '            mywindowbt="down";                                                                                                                                              '+ '\n'+
  170. '        }                                                                                                                                                                       '+ '\n'+
  171. '        else if ( mouse.bt =="up" && mywindowbt == "down" ) {                                                                                                                   '+ '\n'+
  172. '            mywindowbt="up";                                                                                                                                                '+ '\n'+
  173. '            ofx=0;                                                                                                                                                          '+ '\n'+
  174. '            ofy=0;                                                                                                                                                          '+ '\n'+
  175. '            opx=0;                                                                                                                                                          '+ '\n'+
  176. '            opy=0;                                                                                                                                                          '+ '\n'+
  177. '                                                                                            '+ '\n'+
  178. '            if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2 && wincloseSTATUS=="down" ) { top.window.close() }                            '+ '\n'+
  179. '                                                                                            '+ '\n'+
  180. '            wincloseSTATUS="up"                                                                                                                                             '+ '\n'+
  181. '                                                                                                                                                                                '+ '\n'+
  182. '            if ( document.all["mywindowTITLE"] ) {                                                                                                                          '+ '\n'+
  183. '                document.all["mywindowTITLE"].style.backgroundColor = windowTITBGCOLOR                                                                                  '+ '\n'+
  184. '                document.body.style.borderColor   = windowBORDERCOLOR                                                                                                   '+ '\n'+
  185. '                parent.chromewinb.document.bgColor= windowBORDERCOLOR                                                                                                   '+ '\n'+
  186. '                parent.chromewinl.document.bgColor= windowBORDERCOLOR                                                                                                   '+ '\n'+
  187. '                parent.chromewinr.document.bgColor= windowBORDERCOLOR                                                                                                   '+ '\n'+
  188. '            }                                                                                                                                                               '+ '\n'+
  189. '                                                                                            '+ '\n'+
  190. '        }                                                                                                                                                                       '+ '\n'+
  191. '        else if ( mywindowbt == "down" && wincloseSTATUS == "up") {                                                                                                             '+ '\n'+
  192. '            var m_scrx = mouse.screenx;                                                                                                                                     '+ '\n'+
  193. '            var m_scry = mouse.screeny;                                                                                                                                     '+ '\n'+
  194. '            opx = px + ofx - m_scrx;                                                                                                                                        '+ '\n'+
  195. '            opy = py + ofy - m_scry;                                                                                                                                        '+ '\n'+
  196. '            px = m_scrx - ofx;                                                                                                                                              '+ '\n'+
  197. '            py = m_scry - ofy;                                                                                                                                              '+ '\n'+
  198. '            top.window.moveTo(px , py);                                                                                                                                     '+ '\n'+
  199. '        }                                                                                                                                                                       '+ '\n'+
  200. '    setTimeout("initToMoveWin()",50);                                                                                                                                               '+ '\n'+
  201. '}                                                                                                                                                                                      '+ '\n'+
  202. '</script>                                                                                                                                '+ '\n'+
  203. '</head>                                                                                                                                                                            '+ '\n'+
  204. '<body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=no style="border: 1px solid '+ windowBORDERCOLOR +'; overflow: hidden; margin: 0pt;" bgcolor='+windowTITBGCOLOR+'>  '+ '\n'+
  205. '<div id=mywindow><img src="'+windowNONEgrf+'" width=100% height=20></div>                                                                                                                 '+ '\n'+
  206. '<div id=mywindowTITLE>'+ '<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr><td valign=middle align=left>'+windowTIT+'</td></tr></table>' +'</div>                  '+ '\n'+
  207. '<div id=mywindowCLOSE><img name=closewin src="'+ windowCERRARd +'" border=0 width=11 height=11></div>                                                                                  '+ '\n'+
  208. '<div id=mywindowCLOCK><img name=clockwin src="'+ windowCLOCK   +'" border=0 width=11 height=11></div>                                                                                  '+ '\n'+
  209. '</body>                                                                                                                                                                            '+ '\n'+
  210. '<script>initToMoveWin();</script>                                                                            '+ '\n'+
  211. '</html>                                                                                                                                                                            '+ '\n'
  212.  
  213. var chromeFRMhtml = '' +
  214. '<HTML>                                                                        '+ '\n'+
  215. '<HEAD>                                                                                                         '+ '\n'+
  216. '<TITLE>'+ windowREALtit +'</TITLE>                                                                              '+ '\n'+
  217. '</HEAD>                                                                                                        '+ '\n'+
  218. '<script>                                                                     '+ '\n'+
  219. 'mainloaded = false                                                                '+ '\n'+
  220. 'function generatetitle() {                                                             '+ '\n'+
  221. '    if( window.frames["chromewint"] && window.frames["chromewinl"] && window.frames["chromewinb"] && window.frames["chromewinr"] ) {    '+ '\n'+
  222. '        chromewint.document.open();                                                    '+ '\n'+
  223. '        chromewint.document.write( "'+ quitasaltolinea(chromeTIThtml) +'" );                                '+ '\n'+
  224. '        chromewint.document.close();                                                    '+ '\n'+
  225. '        chromewinl.document.bgColor="'+ windowBORDERCOLOR +'"                                        '+ '\n'+
  226. '        chromewinb.document.bgColor="'+ windowBORDERCOLOR +'"                                        '+ '\n'+
  227. '        chromewinr.document.bgColor="'+ windowBORDERCOLOR +'"                                        '+ '\n'+
  228. '    } else {                                                                '+ '\n'+
  229. '        setTimeout("generatetitle()",200)                                                '+ '\n'+
  230. '    }                                                                    '+ '\n'+
  231. '}                                                                        '+ '\n'+
  232. 'generatetitle()                                                                '+ '\n'+
  233. '</script>                                                                    '+ '\n'+
  234. '<frameset border=0 framespacing=0 frameborder=0 rows="22,100%,1" onload="mainloaded=true" onreadystatechange="generatetitle()">        '+ '\n'+
  235. '    <frame name=chromewint src="about:blank" scrolling=no noresize>                                      '+ '\n'+
  236. '    <frameset border=0 framespacing=0 frameborder=0 cols="1,100%,1">                                        '+ '\n'+
  237. '        <frame name=chromewinl src="about:blank" scrolling=no noresize>                                 '+ '\n'+
  238. '        <frame name=main       src="'+theURL+'">                                                       '+ '\n'+
  239. '        <frame name=chromewinr src="about:blank" scrolling=no noresize>                                 '+ '\n'+
  240. '    </frameset>                                                                                             '+ '\n'+
  241. '    <frame name=chromewinb src="about:blank" scrolling=no noresize>                                         '+ '\n'+
  242. '</frameset>                                                                                                    '+ '\n'+
  243. '</HTML>                                                                                                        '
  244.  
  245.         splashWin = window.open( "" , wname, "fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0"+s);
  246.  
  247.         splashWin.resizeTo( Math.ceil( W )       , Math.ceil( H ) );
  248.         splashWin.moveTo  ( Math.ceil( windowX ) , Math.ceil( windowY ) );
  249.  
  250.         splashWin.document.open();
  251.         splashWin.document.write( chromeFRMhtml );
  252.         splashWin.document.close();
  253. }
  254.     else    {
  255.         var splashWin = window.open(theURL, wname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"+s, true);
  256.     }
  257.  
  258.     splashWin.focus();
  259. }                                                                               
  260.                                                                                 
  261. function quitasaltolinea(txt) {
  262.  
  263.   var salida = txt.toString()
  264.   var re     = /\\/g; var salida = salida.replace(re, "\\\\");
  265.   var re     = /\//g; var salida = salida.replace(re, "\\\/");
  266.   var re     = /\"/g; var salida = salida.replace(re, "\\\"");
  267.   var re     = /\'/g; var salida = salida.replace(re, "\\\'");
  268.   var re     = /\n/g; var salida = salida.replace(re, "\\n");
  269.   var re     = /  /g; var salida = salida.replace(re, "");
  270.   var re     = /\t/g; var salida = salida.replace(re, "");
  271.   var re     = /\r/g; var salida = salida.replace(re, "");
  272.  
  273.   return salida
  274.  
  275. //-->